<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@page import="java.text.DateFormat"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.util.List"%>
<%@page import="fr.gest4team.app.pilotage.metier.VersionOm"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Gestion des versions</title>
<script type="text/javascript">
	function supprimer(version, id) {
		alert(version);
		document.getElementById("action").value = "delete";
		document.getElementById("version").value = version;
		document.getElementById("idversion").value = id;
		document.getElementById("formulaire").action="/Pilotage/version.do";
		document.getElementById("formulaire").submit();
	}

	function creer() {
		document.getElementById("action").value = "create";
		document.getElementById("formulaire").action="/Pilotage/version.do";
		document.getElementById("formulaire").submit();
	}
	
	function afficherContenuVersion(version) {
		document.getElementById("action").value = "lister";
		document.getElementById("formulaire").action="/Pilotage/tache.do";
		document.getElementById("idversion").value = version;
		document.getElementById("formulaire").submit();
	}
</script>
<link rel="stylesheet" type="text/css" href="css/main.css" />

</head>
<body>
	<form id="formulaire" name="formulaire" action="/Pilotage/version.do"
		method="post">
		<table>
			<caption>Liste des versions</caption>
			<thead>
				<tr>					
					<th width="80" scope="col">Version</th>
					<th width="80" scope="col">Charge DEV</th>
					<th width="80" scope="col">Conso DEV</th>
					<th width="80" scope="col">RAF DEV</th>
					<th width="80" scope="col">Avancement DEV</th>
					<th width="80" scope="col">Ecart DEV</th>
					<th width="80" scope="col">Nombre GAP</th>
					<th width="80" scope="col">Date livraison RE7</th>
					<th width="80" scope="col">Date livraison Client</th>
					<th width="80" scope="col"></th>
				</tr>
			</thead>
			<tbody>
			<%
				DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
			
			    List<VersionOm> versions = (List<VersionOm>) request.getAttribute("VERSIONS");
				int index = 0;
			    for (VersionOm version : versions) {			        
			%>			
				<tr <%= (index % 2 == 1) ? "class='odd'" : "" %>>					
					<td width="80"><a onclick="afficherContenuVersion('<%=version.getIdVersion()%>')"><%=version.getNom()%></a></td>
					<td width="80"><%=version.getChargeDev()%></td>
					<td width="80"><%=version.getConsommationDev()%></td>
					<td width="80"><%=version.getRafDev()%></td>
					<td width="80"><%=version.getAvancementDev()%></td>
					<td width="80"><%=version.getEcartDev()%></td>
					<td width="80"><%=version.getTaches().size()%></td>
					<td width="80"><%=(version.getDateLivraisonRe7() != null) ? formatter.format(version.getDateLivraisonRe7()) : "" %></td>
					<td width="80"><%=(version.getDateLivriaosnClient() != null) ? formatter.format(version.getDateLivriaosnClient()) : "" %></td>
					<td width="80"><input type="button" value="-"
						onclick="supprimer('<%=version.getNom()%>', '<%=version.getIdVersion()%>');"></input>
					</td>
				</tr>
			<%
					index++;
			    }
			%>			
				<tr <%= (index % 2 == 1) ? "class='odd'" : "" %>>					
					<td><input type="text" size="6" name="nom" /></td>
					<td></td>
					<td></td>
					<td></td>
					<td></td>
					<td></td>
					<td></td>
					<td><input type="text" size="6"  name="dateRe7" /></td>
					<td><input type="text" size="6" name="dateClient" /></td>
					<td><input type="button" value="+" onclick="creer();"></input></td>
				</tr>
			</tbody>
		</table>
		<input type="hidden" name="action" id="action"></input> <input
			type="hidden" name="idversion" id="idversion"></input> <input
			type="hidden" name="version" id="version"></input> <input
			type="hidden" name="projet" id="projet" value="1"></input>
		
		
	</form>
</body>
</html>